﻿using MOKA.TPM.Utility.Const;
using SqlSugar;
using System.ComponentModel.DataAnnotations;

namespace MOKA.TPM.Entity;

/// <summary>
/// 非采物料
/// </summary>
[Tenant(TPMConst.TPMConfigId)]
[SugarTable("Parts", "非采物料")]
public class Parts
{
    /// <summary>
    /// 
    /// </summary>
    [SugarColumn(ColumnName = "Id", ColumnDescription = "", IsPrimaryKey = true)]
    public Guid Id { get; set; }

    /// <summary>
    /// 公司代码
    /// </summary>
    [SugarColumn(ColumnName = "CompanyCode", ColumnDescription = "公司代码")]
    public Guid CompanyCode { get; set; }

    /// <summary>
    /// 物料编号
    /// </summary>
    [SugarColumn(ColumnName = "PartNo", ColumnDescription = "物料编号", Length = 50)]
    [Required, MaxLength(50)]
    public string PartNo { get; set; } = string.Empty;

    /// <summary>
    /// 物料名称
    /// </summary>
    [SugarColumn(ColumnName = "PartName", ColumnDescription = "物料名称", Length = 200)]
    [Required, MaxLength(200)]
    public string PartName { get; set; } = string.Empty;

    /// <summary>
    /// 物料名称2
    /// </summary>
    [SugarColumn(ColumnName = "PartAlternativeName", ColumnDescription = "物料名称2", Length = 50)]
    [MaxLength(50)]
    public string? PartAlternativeName { get; set; }

    /// <summary>
    /// 管理编号
    /// </summary>
    [SugarColumn(ColumnName = "ManageNo", ColumnDescription = "管理编号", Length = 20)]
    [MaxLength(20)]
    public string? ManageNo { get; set; }

    /// <summary>
    /// 管理分类
    /// </summary>
    [SugarColumn(ColumnName = "ManaCategory", ColumnDescription = "管理分类")]
    public Guid? ManaCategory { get; set; }

    /// <summary>
    /// 物料费用类别
    /// </summary>
    [SugarColumn(ColumnName = "PartExpenseType", ColumnDescription = "物料费用类别")]
    public Guid? PartExpenseType { get; set; }

    /// <summary>
    /// 仓位类型
    /// </summary>
    [SugarColumn(ColumnName = "Position", ColumnDescription = "仓位类型")]
    public Guid? Position { get; set; }

    /// <summary>
    /// TPM设备分组
    /// </summary>
    [SugarColumn(ColumnName = "TPMDeviceGroupId", ColumnDescription = "TPM设备分组")]
    public Guid TPMDeviceGroupId { get; set; }

    /// <summary>
    /// 非采类别
    /// </summary>
    [SugarColumn(ColumnName = "TPMCategoryId", ColumnDescription = "非采类别")]
    public Guid TPMCategoryId { get; set; }

    /// <summary>
    /// 品牌
    /// </summary>
    [SugarColumn(ColumnName = "Brand", ColumnDescription = "品牌")]
    public Guid? Brand { get; set; }

    /// <summary>
    /// 型号
    /// </summary>
    [SugarColumn(ColumnName = "Model", ColumnDescription = "型号", Length = 50)]
    [MaxLength(50)]
    public string? Model { get; set; }

    /// <summary>
    /// 供应商名称
    /// </summary>
    [SugarColumn(ColumnName = "Supplier", ColumnDescription = "供应商名称", Length = 100)]
    [MaxLength(100)]
    public string? Supplier { get; set; }

    /// <summary>
    /// 单位
    /// </summary>
    [SugarColumn(ColumnName = "Unit", ColumnDescription = "单位")]
    public Guid Unit { get; set; }

    /// <summary>
    /// 参考单价
    /// </summary>
    [SugarColumn(ColumnName = "Price", ColumnDescription = "参考单价")]
    public decimal? Price { get; set; }

    /// <summary>
    /// 最低库存
    /// </summary>
    [SugarColumn(ColumnName = "LowNum", ColumnDescription = "最低库存")]
    public int? LowNum { get; set; }

    /// <summary>
    /// 最高库存
    /// </summary>
    [SugarColumn(ColumnName = "MaxNum", ColumnDescription = "最高库存")]
    public int? MaxNum { get; set; }

    /// <summary>
    /// 使用周期
    /// </summary>
    [SugarColumn(ColumnName = "UseCycle", ColumnDescription = "使用周期")]
    public decimal? UseCycle { get; set; }

    /// <summary>
    /// 采购周期
    /// </summary>
    [SugarColumn(ColumnName = "ProcurementCycle", ColumnDescription = "采购周期")]
    public decimal? ProcurementCycle { get; set; }

    /// <summary>
    /// 图片
    /// </summary>
    [SugarColumn(ColumnName = "Picture", ColumnDescription = "图片")]
    public byte[] Picture { get; set; }

    /// <summary>
    /// 备注
    /// </summary>
    [SugarColumn(ColumnName = "Remark", ColumnDescription = "备注", Length = 200)]
    [MaxLength(200)]
    public string? Remark { get; set; }

    /// <summary>
    /// SAP创建时间
    /// </summary>
    [SugarColumn(ColumnName = "CreateTimeInSAP", ColumnDescription = "SAP创建时间")]
    public DateTime? CreateTimeInSAP { get; set; }

    /// <summary>
    /// SAP更新时间
    /// </summary>
    [SugarColumn(ColumnName = "UpdateTimeInSAP", ColumnDescription = "SAP更新时间")]
    public DateTime? UpdateTimeInSAP { get; set; }

    /// <summary>
    /// SAP同步时间
    /// </summary>
    [SugarColumn(ColumnName = "SyncTime", ColumnDescription = "SAP同步时间")]
    public DateTime? SyncTime { get; set; }

    /// <summary>
    /// 创建人
    /// </summary>
    [SugarColumn(ColumnName = "CreateUser", ColumnDescription = "创建人", Length = 20)]
    [Required, MaxLength(20)]
    public string CreateUser { get; set; } = string.Empty;

    /// <summary>
    /// 创建时间
    /// </summary>
    [SugarColumn(ColumnName = "CreateTime", ColumnDescription = "创建时间")]
    public DateTime CreateTime { get; set; }

    /// <summary>
    /// 修改人
    /// </summary>
    [SugarColumn(ColumnName = "UpdateUser", ColumnDescription = "修改人", Length = 20)]
    [MaxLength(20)]
    public string? UpdateUser { get; set; }

    /// <summary>
    /// 修改时间
    /// </summary>
    [SugarColumn(ColumnName = "UpdateTime", ColumnDescription = "修改时间")]
    public DateTime? UpdateTime { get; set; }

    /// <summary>
    /// Brand (品牌) 对应的外键实体
    /// </summary>
    [Navigate(NavigateType.ManyToOne, nameof(Brand),nameof(SysDictDetail.Id))]//多对一
    public SysDictDetail sysDictDetail_Brand { get; set; }

    /// <summary>
    /// CompanyCode (公司代码) 对应的外键实体
    /// </summary>
    [Navigate(NavigateType.ManyToOne, nameof(CompanyCode),nameof(SysDictDetail.Id))]//多对一
    public SysDictDetail sysDictDetail_CompanyCode { get; set; }

    /// <summary>
    /// ManaCategory (管理分类) 对应的外键实体
    /// </summary>
    [Navigate(NavigateType.ManyToOne, nameof(ManaCategory),nameof(SysDictDetail.Id))]//多对一
    public SysDictDetail sysDictDetail_ManaCategory { get; set; }

    /// <summary>
    /// PartExpenseType (物料费用类别) 对应的外键实体
    /// </summary>
    [Navigate(NavigateType.ManyToOne, nameof(PartExpenseType),nameof(SysDictDetail.Id))]//多对一
    public SysDictDetail sysDictDetail_PartExpenseType { get; set; }

    /// <summary>
    /// Position (仓位类型) 对应的外键实体
    /// </summary>
    [Navigate(NavigateType.ManyToOne, nameof(Position),nameof(SysDictDetail.Id))]//多对一
    public SysDictDetail sysDictDetail_Position { get; set; }

    /// <summary>
    /// TPMCategoryId (非采类别) 对应的外键实体
    /// </summary>
    [Navigate(NavigateType.ManyToOne, nameof(TPMCategoryId),nameof(SysDictDetail.Id))]//多对一
    public SysDictDetail sysDictDetail_TPMCategoryId { get; set; }

    /// <summary>
    /// TPMDeviceGroupId (TPM设备分组) 对应的外键实体
    /// </summary>
    [Navigate(NavigateType.ManyToOne, nameof(TPMDeviceGroupId),nameof(SysDictDetail.Id))]//多对一
    public SysDictDetail sysDictDetail_TPMDeviceGroupId { get; set; }

    /// <summary>
    /// Unit (单位) 对应的外键实体
    /// </summary>
    [Navigate(NavigateType.ManyToOne, nameof(Unit),nameof(SysDictDetail.Id))]//多对一
    public SysDictDetail sysDictDetail_Unit { get; set; }

    /// <summary>
    /// CreateUser (创建人) 对应的外键实体
    /// </summary>
    [Navigate(NavigateType.ManyToOne, nameof(CreateUser),nameof(T_USER.UserName))]//多对一
    public T_USER t__USER_CreateUser { get; set; }

    /// <summary>
    /// UpdateUser (修改人) 对应的外键实体
    /// </summary>
    [Navigate(NavigateType.ManyToOne, nameof(UpdateUser),nameof(T_USER.UserName))]//多对一
    public T_USER t__USER_UpdateUser { get; set; }

    /// <summary>
    /// 子表：非采物料参数
    /// </summary>
    [Navigate(NavigateType.OneToMany, nameof(PartsParas.PartsId))]//一对多
    public List<PartsParas> PartsParases { get; set; }
}